import request from '@/utils/request'

export function login (parameter) {
  return request({
    url: '/account/login',
    method: 'post',
    data: parameter
  })
}

export function reg (parameter) {
  return request({
    url: '/account/reg',
    method: 'post',
    data: parameter
  })
}

export function page (parameter) {
  return request({
    url: '/account/page',
    method: 'post',
    data: parameter
  })
}

export function edit (parameter) {
  return request({
    url: '/account',
    method: 'put',
    data: parameter
  })
}

export function deleteAll (ids) {
  return request({
    url: '/account',
    method: 'delete',
    data: ids
  })
}

export function findAccount (id) {
  return request({
    url: '/account/' + id,
    method: 'get',
  })
}

export function updateInfo (data) {
  return request({
    url: '/user',
    method: 'put',
	data:data
  })
}

export function updateCompany (data) {
  return request({
    url: '/company',
    method: 'put',
	data:data
  })
}

export function saveAvatar (data) {
const header = { contentType: false, processData: false, headers: { 'Content-Type': 'application/x-www-form-urlencoded' }}
  return request({
    url: '/account/avatar',
    method: 'post',
	headers: header,
	data:data
  })
}

export function getAdminData () {
  return request({
    url: '/anaylize/admin',
    method: 'get',
  })
}

export function getStudentData (id) {
  return request({
    url: '/anaylize/student/' + id,
    method: 'get',
  })
}

export function getCompanyData (id) {
  return request({
    url: '/anaylize/company/' + id,
    method: 'get',
  })
}

export function getTeacherData (id) {
  return request({
    url: '/anaylize/teacher/' + id,
    method: 'get',
  })
}